package com.yida.bean;

import java.sql.Date;
import java.util.List;

import javax.security.auth.kerberos.KerberosKey;


public class blog {
    private Integer id;
    private String title;
    private String summary;
    private Date releaseDate;
    private Integer clickHit;
    private List<comment> replyHit;
    private String content;
    private blogtype typeID;
    private String KeyWord;
    private String imgurl;
    //标记原创还是转载
    private String flag;
    //赞赏的开启
    private boolean appreciation;
    //转载声明是否开启
    private boolean shareStatement;
    //评论的开启
    private boolean commentabled;
    //是否发布
    private Integer published;
    //多对多标签
    private  List<tag> tags;
    private  String  tagsid ;
    
    public void init() {
        this.tagsid = tagsToIds(this.getTags());
    }

    //1,2,3
    private String tagsToIds(List<tag> tags) {
        if (!tags.isEmpty()) {
            StringBuffer ids = new StringBuffer();
            boolean flag = false;
            for (tag tag : tags) {
                if (flag) {
                    ids.append(",");
                } else {
                    flag = true;
                }
                ids.append(tag.getId());
            }
            return ids.toString();
        } else {
            return tagsid;
        }
    }

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public Date getReleaseDate() {
		return releaseDate;
	}

	public void setReleaseDate(Date releaseDate) {
		this.releaseDate = releaseDate;
	}

	public Integer getClickHit() {
		return clickHit;
	}

	public void setClickHit(Integer clickHit) {
		this.clickHit = clickHit;
	}

	public List<comment> getReplyHit() {
		return replyHit;
	}

	public void setReplyHit(List<comment> replyHit) {
		this.replyHit = replyHit;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public blogtype getTypeID() {
		return typeID;
	}

	public void setTypeID(blogtype typeID) {
		this.typeID = typeID;
	}

	public String getKeyWord() {
		return KeyWord;
	}

	public void setKeyWord(String keyWord) {
		KeyWord = keyWord;
	}

	public String getImgurl() {
		return imgurl;
	}

	public void setImgurl(String imgurl) {
		this.imgurl = imgurl;
	}

	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	public boolean isAppreciation() {
		return appreciation;
	}

	public void setAppreciation(boolean appreciation) {
		this.appreciation = appreciation;
	}

	public boolean isShareStatement() {
		return shareStatement;
	}

	public void setShareStatement(boolean shareStatement) {
		this.shareStatement = shareStatement;
	}

	public boolean isCommentabled() {
		return commentabled;
	}

	public void setCommentabled(boolean commentabled) {
		this.commentabled = commentabled;
	}

	public Integer getPublished() {
		return published;
	}

	public void setPublished(Integer published) {
		this.published = published;
	}

	public List<tag> getTags() {
		return tags;
	}

	public void setTags(List<tag> tags) {
		this.tags = tags;
	}

	public String getTagsid() {
		return tagsid;
	}

	public void setTagsid(String tagsid) {
		this.tagsid = tagsid;
	}

	public blog(Integer id, String title, String summary, Date releaseDate, Integer clickHit, List<comment> replyHit,
			String content, blogtype typeID, String keyWord, String imgurl, String flag, boolean appreciation,
			boolean shareStatement, boolean commentabled, Integer published, List<tag> tags, String tagsid) {
		super();
		this.id = id;
		this.title = title;
		this.summary = summary;
		this.releaseDate = releaseDate;
		this.clickHit = clickHit;
		this.replyHit = replyHit;
		this.content = content;
		this.typeID = typeID;
		KeyWord = keyWord;
		this.imgurl = imgurl;
		this.flag = flag;
		this.appreciation = appreciation;
		this.shareStatement = shareStatement;
		this.commentabled = commentabled;
		this.published = published;
		this.tags = tags;
		this.tagsid = tagsid;
	}

	public blog() {
		super();
		// TODO Auto-generated constructor stub
	}

	@Override
	public String toString() {
		return "blog [id=" + id + ", title=" + title + ", summary=" + summary + ", releaseDate=" + releaseDate
				+ ", clickHit=" + clickHit + ", replyHit=" + replyHit + ", content=" + content + ", typeID=" + typeID
				+ ", KeyWord=" + KeyWord + ", imgurl=" + imgurl + ", flag=" + flag + ", appreciation=" + appreciation
				+ ", shareStatement=" + shareStatement + ", commentabled=" + commentabled + ", published=" + published
				+ ", tags=" + tags + ", tagsid=" + tagsid + "]";
	}
    
}
    
    
    